﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL
{
  public  class ConverType
  {
      public static int  ToInt(object value)
      {
          try 
	    {	  
      return Convert.ToInt32(value);
		
	    }
	catch 
	    {
		return 0;
	
	    }
      }
      public static int IsDBNull(object value)
      {
          try
          {
              if (value == DBNull.Value.ToString())
                  value = 0;
              return Convert.ToInt32(value);

          }
          catch
          {
              return 0;

          }
      }
      public static string ToString(object value)
      {
          try
          {
              return Convert.ToString(value);

          }
          catch
          {
              return null;

          }
      }
      public static DateTime ToDateTime(object value)
      {
          try
          {
              return Convert.ToDateTime(value);

          }
          catch
          {
              return DateTime.Now;

          }
      }
    }
}
